/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrateur
 */
@Entity
@Table(name = "langue")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Langue.findAll", query = "SELECT l FROM Langue l"),
    @NamedQuery(name = "Langue.findByIdlangue", query = "SELECT l FROM Langue l WHERE l.idlangue = :idlangue"),
    @NamedQuery(name = "Langue.findByNom", query = "SELECT l FROM Langue l WHERE l.nom = :nom"),
    @NamedQuery(name = "Langue.findByLabel", query = "SELECT l FROM Langue l WHERE l.label = :label")})
public class Langue implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idlangue")
    private Integer idlangue;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nom")
    private String nom;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "label")
    private String label;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idlangue")
    private Collection<TypeClient> typeClientCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idlangue")
    private Collection<EtatCommande> etatCommandeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLangue")
    private Collection<Client> clientCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLangue")
    private Collection<Description> descriptionCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idlangue")
    private Collection<TypeProduit> typeProduitCollection;

    public Langue() {
    }

    public Langue(Integer idlangue) {
        this.idlangue = idlangue;
    }

    public Langue(Integer idlangue, String nom, String label) {
        this.idlangue = idlangue;
        this.nom = nom;
        this.label = label;
    }

    public Integer getIdlangue() {
        return idlangue;
    }

    public void setIdlangue(Integer idlangue) {
        this.idlangue = idlangue;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @XmlTransient
    public Collection<TypeClient> getTypeClientCollection() {
        return typeClientCollection;
    }

    public void setTypeClientCollection(Collection<TypeClient> typeClientCollection) {
        this.typeClientCollection = typeClientCollection;
    }

    @XmlTransient
    public Collection<EtatCommande> getEtatCommandeCollection() {
        return etatCommandeCollection;
    }

    public void setEtatCommandeCollection(Collection<EtatCommande> etatCommandeCollection) {
        this.etatCommandeCollection = etatCommandeCollection;
    }

    @XmlTransient
    public Collection<Client> getClientCollection() {
        return clientCollection;
    }

    public void setClientCollection(Collection<Client> clientCollection) {
        this.clientCollection = clientCollection;
    }

    @XmlTransient
    public Collection<Description> getDescriptionCollection() {
        return descriptionCollection;
    }

    public void setDescriptionCollection(Collection<Description> descriptionCollection) {
        this.descriptionCollection = descriptionCollection;
    }

    @XmlTransient
    public Collection<TypeProduit> getTypeProduitCollection() {
        return typeProduitCollection;
    }

    public void setTypeProduitCollection(Collection<TypeProduit> typeProduitCollection) {
        this.typeProduitCollection = typeProduitCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idlangue != null ? idlangue.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Langue)) {
            return false;
        }
        Langue other = (Langue) object;
        if ((this.idlangue == null && other.idlangue != null) || (this.idlangue != null && !this.idlangue.equals(other.idlangue))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Langue[ idlangue=" + idlangue + " ]";
    }
    
}
